< previous page page_476 next page >

Page 476
z0496-01.gif
Figure 14.7
A grid approximating an incomplete data set.
Next, InitializeGrid calls the routine WeightedAverage to compute a weighted average of the values found in the previous step. Suppose the four nearest data points have coordinates (x1, y1, z1), . . . , (x4, y4, z4). Let d1, d2, d3, and d4 be the squares of the distances from those points to the grid location of interest in the X-Z plane. For instance, if the grid point is at (x, z), then d1 = (x x1)2 + (z z1)2. Routine WeightedAverage sets the Y value at the grid location to be:
e10a6a0a59f035e870d90cca05b85fce.gif
(y1 * d2 * d3 * d4 +
 y2 * d1 * d3 * d4 +
 y3 * d1 * d2 * d4 +
 y4 * d1 * d2 * d3) /
(d2 * d3 * d4 +
 d1 * d3 * d4 +
 d1 * d2 * d4 +
 d1 * d2 * d3)
This weighted average has two important properties. First, as one of the distances di approaches zero, the value of y approaches the corresponding data value yi. For example, if d1 is close to zero, then the equation above is close to:
e10a6a0a59f035e870d90cca05b85fce.gif
(y1 * d2 * d3 * d4)/(d2 * d3 * d4) = y1
This property is important because it means a grid point close to an actual data point gets a Y value close to the actual data point's Y value.
The second property of this weighted average is that it emphasizes closer points heavily. By using the squares of the distances in its calculations, the routine gives nearby data points much greater weight than points farther away. This is particularly important

 
< previous page page_476 next page >